//
// Created by wenyaxi on 24-10-29.
//
#include <common.h>

class Solution {
public:
    vector<int> twoSum(vector<int> &nums, int target) {
        auto map=make_unique<unordered_map<int, int>>();
        for (auto i=0;i<nums.size();i++) {
            if(map->contains(target-nums[i])) {
                return {map->at(target-nums[i]), i};
            }
            map->insert(make_pair(nums[i], i));
        }
        return {-1,-1};
    }
};

int main(int argc, char *argv[]) {
    Solution s;
    //[2,7,11,15]
    //9
    vector<int> v{3,2,4};
    auto two_sum = s.twoSum(v, 6);
    cout << printer::arrayToString(two_sum) << endl;
}
